package pl.cvplus.entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Piotrek
 * Date: 02.03.12
 * Time: 23:16
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "cp_language", schema = "public", catalog = "")
@Entity
public class CpLanguage {
    private Integer id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    private String languageName;

    @javax.persistence.Column(name = "language_name", nullable = true, insertable = true, updatable = true, length = 20, precision = 0)
    @Basic
    public String getLanguageName() {
        return languageName;
    }

    public void setLanguageName(String languageName) {
        this.languageName = languageName;
    }

    private String label;

    @javax.persistence.Column(name = "label", nullable = true, insertable = true, updatable = true, length = 5, precision = 0)
    @Basic
    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CpLanguage that = (CpLanguage) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (label != null ? !label.equals(that.label) : that.label != null) return false;
        if (languageName != null ? !languageName.equals(that.languageName) : that.languageName != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (languageName != null ? languageName.hashCode() : 0);
        result = 31 * result + (label != null ? label.hashCode() : 0);
        return result;
    }

    private Collection<CpCv> cpCvsById;

    @OneToMany(mappedBy = "cpLanguageByLanguageFk")
    public Collection<CpCv> getCpCvsById() {
        return cpCvsById;
    }

    public void setCpCvsById(Collection<CpCv> cpCvsById) {
        this.cpCvsById = cpCvsById;
    }

    private Collection<CpDictionaryValue> cpDictionaryValuesById;

    @OneToMany(mappedBy = "cpLanguageByLanguageFk")
    public Collection<CpDictionaryValue> getCpDictionaryValuesById() {
        return cpDictionaryValuesById;
    }

    public void setCpDictionaryValuesById(Collection<CpDictionaryValue> cpDictionaryValuesById) {
        this.cpDictionaryValuesById = cpDictionaryValuesById;
    }

    private Collection<CpPersonalData> cpPersonalDatasById;

    @OneToMany(mappedBy = "cpLanguageByLanguagePk")
    public Collection<CpPersonalData> getCpPersonalDatasById() {
        return cpPersonalDatasById;
    }

    public void setCpPersonalDatasById(Collection<CpPersonalData> cpPersonalDatasById) {
        this.cpPersonalDatasById = cpPersonalDatasById;
    }
}
